package com.cldz.controller;

import com.cldz.common.dto.req.DevAlarmConditionDto;
import com.cldz.common.dto.res.DevAlarmConditionResDto;
import com.cldz.feign.DevAlarmConditionFeign;
import com.cldz.response.support.ServerResponse;
import com.cldz.service.DevAlarmConditionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ Author     ：lixiao.
 * @ Date       ：Created in 11:12 2018/12/19
 * @ Description：
 * @ Modified By：
 */
@RestController
@Slf4j
public class DevAlarmConditionController implements DevAlarmConditionFeign {

    @Autowired
    private DevAlarmConditionService devAlarmConditionService;

    /**
     * 获取基本告警条件
     * @param devAlarmConditionDto
     * @return
     */
    @GetMapping("/baseAlarmConList")
    public ServerResponse getBaseAlarmConList(DevAlarmConditionDto devAlarmConditionDto){
        List<DevAlarmConditionResDto> baseAlarmConList = devAlarmConditionService.getBaseAlarmConList(devAlarmConditionDto);
        return ServerResponse.createDataList(baseAlarmConList);
    }

    /**
     * 获取设备告警条件
     * @param devAlarmConditionDto
     * @return
     */
    @GetMapping("/alarmConList")
    public ServerResponse getAlarmConList(DevAlarmConditionDto devAlarmConditionDto){
        List<DevAlarmConditionResDto> list = devAlarmConditionService.getAlarmConList(devAlarmConditionDto);
        return ServerResponse.createDataList(list);
    }
}
